<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>人员管理添加修改 </title>
    <base target="_self" />
    <link href="Styles/css.css" rel="stylesheet" type="text/css" />
    <link href="Styles/ts_css.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        $(function () {
            if ($("#btnSubmit").val() == "提交") {
                if ($("#hidorganizationId").val() == "0") {
                    alert("请选择要添加的部门;window.close()");
                    return false;
                }
            }
           

        });
        function page_Close() {
            if (window.parent != null) {
                window.parent.close();
            }
            else {
                window.close();
            }
        }
        function selectroom(){
         var rid = document.form.roomId.value;
         location.href="selectroom.do?roomId="+rid;
        }
        function chkvalue(txt) {
         var rid = txt.value;
       // location.href="selectroom.do?roomId="+rid;
       $.ajax({
					url:"selectroom.do",
					 async:true, 
					data:{roomId:rid},
					type:"post",
					timeout:5000,    //超时时间
                    dataType:'json',
					success:function(data){
                     $("#projectId").val(data.room.projectId);  
                    $("#buildId").val(data.room.buildId);
                     }
				});
     }
      function selectroom(txt){
      var cid = txt.value;
     $.ajax({
        url:"selectSaleManage.do",
					 async:true, 
					data:{customerId:cid},
					type:"post",
					timeout:5000,    //超时时间
                    dataType:'json',
					success:function(data){
					
                     $("#customerName").val(data.customer.customerName); 
                     $("#tel").val(data.customer.tel);
                     $("#userName").val(data.customer.userName);
                     $("#userId").val(data.customer.userId);
                     $("#tel").val(data.customer.tel);  
                      $("#intentionDescription").val(data.customer.intentionDescription);  
                     }
        
     }); 
     }
    </script>
</head>
<body>
    <form method="post" action="addsaleManager.do" id="form1">
    <div>
        <table border="0" cellpadding="2" cellspacing="2" class="table_list1">
            <tr>
                <td width="10%" class="table_list1_style1">
                  机会名称
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="saleChanceName" type="text" value=" " maxlength="25" id="saleChanceName"
                        style="width: 90%;"  />
                </td>
				</tr>
            <tr>
                <td width="10%" class="table_list1_style1">
                    房间编号
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="roomId" type="text" value=" " maxlength="50" id="roomId"
                        style="width: 90%;" onblur="chkvalue(this)" />
                </td>
				</tr>
            <tr>
            <td width="10%" class="table_list1_style1">
                    客户编号
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="customerId" type="text"  maxlength="50" id="customerId"
                        style="width: 90%;" onblur="selectroom(this)"/>
                </td>
                </tr>
            <tr>
             <td width="10%" class="table_list1_style1">
                    客户姓名
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="customerName" type="text"  maxlength="25" id="customerName"
                        style="width: 90%;" />
                </td> 
                 </tr>
            <tr>
                <td width="10%" class="table_list1_style1">
                    <font class="red">*</font> 客户电话
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="tel" type="text"  maxlength="20" id="tel"
                        style="width: 90%;" />
                </td>
            </tr>
            <tr>
               <td width="10%" class="table_list1_style1">
                    业务员名称
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="userName" type="text" value=" " maxlength="25" id="userName"
                        style="width: 90%;" />
                </td> 
				</tr>
            <tr>
				<td width="10%" class="table_list1_style1">
                    业务员编号
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="number" type="text" value=" " maxlength="25" id="number"
                        style="width: 90%;" />
                </td>
            </tr>
            <tr>
                <td width="10%" class="table_list1_style1">
                    状态
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="state" type="text" value=" " maxlength="25" id="state"
                        style="width: 90%;" />
                </td>
                 </tr>
            <tr>
                
                <td width="10%" class="table_list1_style1">
                    项目编号
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="projectId" type="text"  maxlength="25" id="projectId"
                        style="width: 90%;" />
                </td>
				</tr>
            <tr>
               <td width="10%" class="table_list1_style1">
                    楼栋编号
                </td>
                <td width="20%" class="table_list1_style2">
                    <input name="buildId" type="text"  maxlength="25" id="buildId"
                        style="width: 90%;" />
                </td>
				 <td width="10%" class="table_list1_style1">
                  
                </td>
                <td width="20%" class="table_list1_style2">
                    
                </td>
            </tr>
            <tr>
                
            <tr>
               
                <td width="10%" class="table_list1_style1">
                    客户意向描述
                </td>
                <td colspan="5" width="20%" class="table_list1_style2">
                    <textarea name="intentionDescription" rows="2" cols="20" id="intentionDescription" style="width: 60%;">
</textarea>
                </td>
				
            </tr>
        </table>
        <div class="operate">
            <ul>
                <li>
                    <input type="submit" name="btnSubmit" value="添加" id="btnSubmit" class="button" />
                </li>
                <li>
                    <input id="btnBack" type="button" class="button" value="关闭" onclick="page_Close()" />
                </li>
            </ul>
        </div>
    </div>
    <input type="hidden" name="hidorganizationId" id="hidorganizationId" />
    </form>
</body>
</html>
